MoveAxisRelative
下达一个目标为特定相对位置之运动指令。呼叫此命令时,给定之相对距离将添加于当前设置位置。
语法
KsCommandStatus MoveAxisRelative(
int Index,
double Distance,
double Velocity,
double Acceleration,
double Deceleration,
double Jerk,
McBufferMode BufferMode
);
参数
Index [in]:轴索引。索引以零为起点;别名将影响此参数。
Distance [in]:运动的相对距离,[单位]。
Velocity [in]:最大速度值,(非必要到达)[单位/秒]
Acceleration [in]:加速度值,单位由 McProfileType 类型决定,(马达的增加能源) [单位/秒2] 或 [秒]。
Deceleration [in]:减速度值,单位由 McProfileType 类型决定,(马达的减少能源) [单位/秒2] 或 [秒]。
Jerk [in]:加加速度值,单位由 McProfileType 类型决定,为 [单位/秒3] 或 [秒]。
BufferMode [in]:定义如何融合两功能的速度,请见 McBufferMode 类型。
回传值
返回 KsCommandStatus 结构。
备注
范例
VOID MoveRelative(INT Index, DOUBLE Distance) {
//Start an relative move.
KsCommandStatus status = WaitForCommand(30, TRUE, MoveAxisRelative(Index, Distance,
3600, 36000, 36000, 3600000, mcAborting));
//Print the final position.
double setPosition = 0;
KsError nRet = GetAxisPosition(Index, mcSetValue, &setPosition);
double actPosition = 0;
nRet = GetAxisPosition(Index, mcSetValue, &actPosition);
RtPrintf("Current Position: Target %d, Actual %d\n", (int)setPosition, (int)actPosition);
}
使用需求
RT | Win32 | |
---|---|---|
最低支援版本 | 4.0 | 4.0 |
标头档 | ksmotion.h | ksmotion.h |
程式库 | KsApi_Rtss.lib | KsApi.lib |
参见